<style lang="scss">
	/* 注意要写在第一行，同时给style标签加入lang="scss"属性 */
	@import "uview-plus/index.scss";
  page {
    background: #fff;
    font-family: "Helvetica Neue", Helvetica, Arial, "PingFang SC", "Hiragino Sans GB", "Heiti SC", "Microsoft YaHei", "WenQuanYi Micro Hei", sans-serif !important;
  }
</style>
<script setup lang="ts">
import { onLaunch, onShow, onHide } from '@dcloudio/uni-app'
onLaunch(() => {
  console.log('App Launch')
  conoverShare()
  // uni.showShareMenu({
  //   withShareTicket: true,
  //   menus: ['shareAppMessage', 'shareTimeline']
  //   // title: '这是标题',
  //   // content: '这是内容',
  //   // imageUrl: '',
  //   // path: '/pages/index/index'
  // })
})
onShow(() => {
  console.log('App Show')
  // uni.setTabBarBadge({
  //   index: 2,
  //   text: 'HOT'
  // })
})
onHide(() => {
  console.log('App Hide')
})
const conoverShare = () => {
  //监听路由切换, 间接实现全局设置分享内容
  wx.onAppRoute(res => {
    //获取加载的页面
    const pages = getCurrentPages()
    //获取当前页面的对象
    const view = pages[pages.length - 1];
    if (view) {
      //全局触发 显示出分享具栏
      wx.showShareMenu({
          withShareTicket: true,
          //设置下方的Menus菜单，才能够让发送给朋友与分享到朋友圈两个按钮可以点击
          menus: ["shareAppMessage", "shareTimeline"]
      })
    }
  })
}
</script>
